package com.ruoyi.material.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.material.domain.BaseLabel;
import com.ruoyi.material.domain.BaseMaterial;
import com.ruoyi.material.domain.vo.BaseLabelTypeTreeVo;
import com.ruoyi.material.domain.vo.BaseMaterialTreeVo;
import com.ruoyi.material.domain.vo.LabelTypeVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.material.mapper.BaseLabelTypeMapper;
import com.ruoyi.material.domain.BaseLabelType;
import com.ruoyi.material.service.IBaseLabelTypeService;

/**
 * 标签类别Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-27
 */
@Service
public class BaseLabelTypeServiceImpl implements IBaseLabelTypeService 
{
    @Autowired(required = false)
    private BaseLabelTypeMapper baseLabelTypeMapper;

    /**
     * 查询标签类别
     * 
     * @param id 标签类别ID
     * @return 标签类别
     */
    @Override
    public BaseLabelType selectBaseLabelTypeById(Long id)
    {
        return baseLabelTypeMapper.selectBaseLabelTypeById(id);
    }

    /**
     * 查询标签类别列表
     *
     * @param baseLabelType 标签类别
     * @return 标签类别集合
     */
    @Override
    public List<LabelTypeVo> selectBaseLabelTypeList(BaseLabelType baseLabelType){
        return baseLabelTypeMapper.selectBaseLabelTypeList(baseLabelType);
    }
    /**
     * 新增标签类别
     * 
     * @param baseLabelType 标签类别
     * @return 结果
     */
    @Override
    public int insertBaseLabelType(BaseLabelType baseLabelType)
    {
        baseLabelType.setCreateTime(DateUtils.getNowDate());
        return baseLabelTypeMapper.insertBaseLabelType(baseLabelType);
    }

    /**
     * 修改标签类别
     * 
     * @param baseLabelType 标签类别
     * @return 结果
     */
    @Override
    public int updateBaseLabelType(BaseLabelType baseLabelType)
    {
        baseLabelType.setUpdateTime(DateUtils.getNowDate());
        return baseLabelTypeMapper.updateBaseLabelType(baseLabelType);
    }

    /**
     * 批量删除标签类别
     * 
     * @param ids 需要删除的标签类别ID
     * @param updateBy
     * @return 结果
     */
    @Override
    public int deleteBaseLabelTypeByIds(@Param("ids")Long[] ids,@Param("updateBy") String updateBy)
    {
        return baseLabelTypeMapper.deleteBaseLabelTypeByIds(ids,updateBy);
    }

    /**
     * 删除标签类别信息
     * 
     * @param id 标签类别ID
     * @return 结果
     */
    @Override
    public int deleteBaseLabelTypeById(Long id)
    {
        return baseLabelTypeMapper.deleteBaseLabelTypeById(id);
    }
    /**
     * 查询所有标签类别
     *
     * @return 标签类别集合
     */
    public List<BaseLabelType> selectAllType(){
        return baseLabelTypeMapper.selectAllType();
    }
    /**
     * 根据标签类别名字找到id,即type_code
     * @param labelType
     * @return 标签类别集合
     */
    @Override
    public int selectBaseLabelTypeByLabel(String labelType){
        return baseLabelTypeMapper.selectBaseLabelTypeByLabel(labelType);
    }

}
